package IOMyhead;

import java.io.*;

public class T2B {
    public static void main(String[] args) {
        File file1 = new File("C:\\Users\\wangzihong\\Desktop\\20175209\\课上练习及课下作业\\src\\IOMyhead","20175209.txt");
        File file2 = new File("C:\\Users\\wangzihong\\Desktop\\20175209\\课上练习及课下作业\\src\\IOMyhead","20175209.bin");
        int n=10;
        String s = "";
        String out1="";
        try {
            FileReader in = new FileReader(file1);
            FileWriter out = new FileWriter(file2,true);
            char [] number = new char[1045];
            in.read(number);
            s = new String(number);
            String [] num = s.split("\r\n");
            for(int i=0;i<n;i++) {
                out1="" + Integer.toBinaryString(Integer.parseInt(num[i]))+"\r\n";
                out.write(out1);
            }
            out.close();
        }
        catch(Exception e){}
    }
}
